package com.jk.vehicle.mini.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.jk.vehicle.core.entity.BaseEntity;
import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.*;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

@ApiModel("里程数据对象")
@Table(name = "mileage_record")
@Data
public class MileageRecord extends BaseEntity {
    /**
     * 单次里程km
     */
    @ApiModelProperty("单次里程km")
	private BigDecimal mileage;

    /**
     * 开始时间
     */
    @Column(name = "start_time")
    @ApiModelProperty(value = "里程开始时间", example = "2021/02/18 09:46:00")
	private Date startTime;

    /**
     * 结束时间
     */
    @Column(name = "end_time")
    @ApiModelProperty(value = "里程结束时间", example = "2021/02/18 09:26:00")
	private Date endTime;

    /**
     * 骑行时间（秒）
     */
    @ApiModelProperty("骑行时间（秒）")
    @Column(name = "ride_seconds")
    private Long rideSeconds;

    /**
     * 里程记录时的日期
     */
    @Column(name = "record_date")
    @ApiModelProperty(value = "里程记录时的日期", example = "2021/02/18")
	private Date recordDate;

    /**
     * 最高速度 
     */
    @Column(name = "top_speed")
    @ApiModelProperty("最高速度km/h")
	private BigDecimal topSpeed;

    /**
     * 平均速度
     */
    @Column(name = "avg_speed")
    @ApiModelProperty("平均速度km/h")
	private BigDecimal avgSpeed;

    /**
     * 车辆ID
     */
    @Column(name = "bicycle_id")
    @ApiModelProperty("车辆ID")
	private Long bicycleId;

    /**
     * 厂家ID
     */
    @ApiModelProperty("厂家ID")
    @TableField(exist = false)
    private Long corpId;

    /**
     * 人员ID
     */
    @Column(name = "user_id")
    @ApiModelProperty("人员ID")
	private Long userId;

    /**
     * 创建时间
     */
    @Column(name = "create_date")
    @ApiModelProperty(hidden = true)
	private Date createDate;

    /**
     * 更新时间
     */
    @Column(name = "update_date")
    @ApiModelProperty(hidden = true)
	private Date updateDate;

    public static final class MileageRecordBuilder {
        private Long id;
        private BigDecimal mileage;
        private Byte delFlag = 0;
        private Date startTime;
        private Date endTime;
        private Long rideSeconds;
        private Date recordDate;
        private BigDecimal topSpeed;
        private BigDecimal avgSpeed;
        private Long bicycleId;
        private Long userId;
        private Date createDate;
        private Date updateDate;

        private MileageRecordBuilder() {
        }

        public static MileageRecordBuilder aMileageRecord() {
            return new MileageRecordBuilder();
        }

        public MileageRecordBuilder withId(Long id) {
            this.id = id;
            return this;
        }

        public MileageRecordBuilder withMileage(BigDecimal mileage) {
            this.mileage = mileage;
            return this;
        }

        public MileageRecordBuilder withDelFlag(Byte delFlag) {
            this.delFlag = delFlag;
            return this;
        }

        public MileageRecordBuilder withStartTime(Date startTime) {
            this.startTime = startTime;
            return this;
        }

        public MileageRecordBuilder withEndTime(Date endTime) {
            this.endTime = endTime;
            return this;
        }

        public MileageRecordBuilder withRideSeconds(Long rideSeconds) {
            this.rideSeconds = rideSeconds;
            return this;
        }

        public MileageRecordBuilder withRecordDate(Date recordDate) {
            this.recordDate = recordDate;
            return this;
        }

        public MileageRecordBuilder withTopSpeed(BigDecimal topSpeed) {
            this.topSpeed = topSpeed;
            return this;
        }

        public MileageRecordBuilder withAvgSpeed(BigDecimal avgSpeed) {
            this.avgSpeed = avgSpeed;
            return this;
        }

        public MileageRecordBuilder withBicycleId(Long bicycleId) {
            this.bicycleId = bicycleId;
            return this;
        }

        public MileageRecordBuilder withUserId(Long userId) {
            this.userId = userId;
            return this;
        }

        public MileageRecordBuilder withCreateDate(Date createDate) {
            this.createDate = createDate;
            return this;
        }

        public MileageRecordBuilder withUpdateDate(Date updateDate) {
            this.updateDate = updateDate;
            return this;
        }

        public MileageRecord build() {
            MileageRecord mileageRecord = new MileageRecord();
            mileageRecord.setId(id);
            mileageRecord.setMileage(mileage);
            mileageRecord.setDelFlag(delFlag);
            mileageRecord.setStartTime(startTime);
            mileageRecord.setEndTime(endTime);
            mileageRecord.setRideSeconds(rideSeconds);
            mileageRecord.setRecordDate(recordDate);
            mileageRecord.setTopSpeed(topSpeed);
            mileageRecord.setAvgSpeed(avgSpeed);
            mileageRecord.setBicycleId(bicycleId);
            mileageRecord.setUserId(userId);
            mileageRecord.setCreateDate(createDate);
            mileageRecord.setUpdateDate(updateDate);
            return mileageRecord;
        }
    }
}